package com.ls.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ls.entity.OrderRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * <p>
 * 订单记录 Mapper 接口
 * </p>
 *
 * @author pengyu
 * @since 2024-10-12
 */
public interface OrderRecordMapper extends BaseMapper<OrderRecord> {
    /**
     * 根据订单编号查询订单
     *
     * @param orderNum
     * @return OrderRecord
     */
    OrderRecord getOrderRecordByOrderNum(@Param("orderNum") String orderNum);
    @Select("SELECT SUM(fee) FROM order_record WHERE order_status = 1 AND pay_time BETWEEN #{start} AND #{end}")
    BigDecimal selectTodayRechargeAmount(@Param("start") LocalDateTime start,
                                         @Param("end") LocalDateTime end);
}
